package com.zeropoint.demo.api;


import com.zeropoint.demo.pojo.*;
import lombok.Data;

/**
 * 标准化模块API
 */
@Data
public class Api {

    private HumanResourceStandardized h;
    private NaturalResourceStandardized n;
    private MaterialResourceStandardized m;
    private SocialResourceStandardized s;
    private FamilyIncomeStandardized i;
    private FamilyOutcomeStandardized o;
    private WeightAlgorithm w;

    public Api(FormTotal formTotal){

          all_standardized(
                formTotal.getQuestionnaire_info(),
                formTotal.getFormOne(),
                formTotal.getFormTwo(),
                formTotal.getFormThree(),
                formTotal.getFormFour());

    }


    /**
     * 基本标准化处理---将全部原始数据进行标准化后，返回综合分值
     */
     public double all_standardized(Questionnaire_info info, FormOne one, FormTwo two
     , FormThree three, FormFour four){
         //顺序不能乱
         //人力资源
          h = new HumanResourceStandardized(one);
         //自然资源
          n = new NaturalResourceStandardized(info, two);
         //物资资源
          m = new MaterialResourceStandardized(two);
         //社会资源SocialExpenditure
          s = new SocialResourceStandardized(four.socialExpenditure.contactNumber, two);
         //家庭收入
          i = new FamilyIncomeStandardized(info, three);
         //家庭支出
          o = new FamilyOutcomeStandardized(four, two, info, i.totalRevenue);
         //权值
          w = new WeightAlgorithm(info, one, two, three, four, h, n, m, i, s, o);

         return w.result;
     }
}
